package ihm.actions.files;

import java.io.File;
import java.util.ArrayList;

import javax.swing.filechooser.FileFilter;

public class ATKfileFilter extends FileFilter
{
  private ArrayList<String> suffixList;
  private String description;
  
  public ATKfileFilter()
  {
    this.suffixList = new ArrayList<String>();
  }
  
  public void addSuffixe(String suffix)
  {
    this.suffixList.add(suffix);
  }
  public boolean accept(File f)
  {
    if(this.suffixList.size() == 0)
      return true;
    
    for(String suffix : this.suffixList)
      if(f.getName().endsWith(suffix))
        return true;
    
    return false;
  }

  public void setDescription(String newDescription)
  {
    this.description = newDescription;
  }
  
  public String getDescription() {
    return this.description;
  }
  
}